import Vue from 'vue'
import Vuex from 'vuex'
import userModule from './modules/user'
import cartModules from '@/store/modules/cart'
import createPersistedState from 'vuex-persistedstate'
import registerModule from './modules/register'
import addressModule from './modules/address'
import saveNumber from './plugins/savePhone'
import saveAddress from './plugins/saveAddress'

Vue.use(Vuex)

export default new Vuex.Store({
  plugins: [saveNumber, saveAddress, createPersistedState({
    storage: sessionStorage, // 保存到本地存储中，默认为 localStorage
  })],
  state: {
  },
  getters: {
  },
  mutations: {
  },
  actions: {
  },
  modules: {
    user: userModule,
    cart: cartModules,
    register: registerModule,
    address: addressModule,

  },
})
